package com.ct.gd.passport.view.policy;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.view.View.OnClickListener;

import com.ct.gd.passport.R;
import com.ct.gd.passport.common.BaseActivity;
import com.ct.gd.passport.common.constants.UmengVar;
import com.ct.gd.passport.view.widget.CustomHeaderFragment;
import com.umeng.analytics.MobclickAgent;

public class PolicyActivity extends BaseActivity implements OnClickListener {

	private FragmentManager				mFgMan;
	private CustomHeaderFragment		mFgHeader;
	private RootPolicyCatalogFragment	mFgRootPolicyCatalog;
	private PolicyCatalogFragment		mFgPolicyCatalog;

	@Override
	protected void onBaseCreate(Bundle savedInstanceState) {
		setContentView(R.layout.policy);
	}

	@Override
	protected void initViews() {
		mFgMan = getSupportFragmentManager();

		mFgHeader = (CustomHeaderFragment) mFgMan.findFragmentById(R.id.header);
		mFgHeader.setCenterText(R.string.policy);
		mFgHeader.setRightText(R.string.policy_search);
		mFgHeader.setRightOnClickListener(this);

		mFgRootPolicyCatalog = (RootPolicyCatalogFragment) mFgMan.findFragmentById(R.id.area_policy_root_catalog);
		mFgPolicyCatalog = (PolicyCatalogFragment) mFgMan.findFragmentById(R.id.area_policy_catalog);
	}

	@Override
	protected void onAfterCreate(Bundle savedInstanceStat) {
		super.onAfterCreate(savedInstanceStat);
		mFgRootPolicyCatalog.registerOnRootChangedListener(mFgPolicyCatalog);
	}

	@Override
	public void onClick(View v) {
		MobclickAgent.onEvent(this, UmengVar.POLICY_INTRO_SEARCH);
		startActivity(new Intent(this, PolicySearchActivity.class));
	}

}
